﻿using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;

namespace Mars.GpuInstance
{
    public class GPUAnimatorGenConfig : ScriptableObject
    {
        public GPUAnimationData animationData;
        public TextAsset anchorInfo;
        public int frameRate = 30;
        public ShadowLod animatorShadowLod = ShadowLod.AUTO_SELECT;
        [Header("名字转的hashcode")]
        public int prefabName;
        [Header("计算包围盒时把包围盒扩大一点，避免看到在边缘的时候模型被裁剪掉")]
        public Vector3 boxExtents = Vector3.zero;
        public List<SkinMeshLodData> LodDatas = new List<SkinMeshLodData>();
    }
    
    
    
    [Serializable]
    public class SkinMeshLodData : IComparable<SkinMeshLodData>
    {
        public int lodDis;
        public List<SkinMeshRenderData> renderDatas;

        public int CompareTo(SkinMeshLodData obj)
        {
            if (lodDis == obj.lodDis)
            {
                return 0;
            }
            else if (lodDis > obj.lodDis)
            {
                return 1;
            }

            return -1;
        }
    }

    [Serializable]
    public class SkinMeshRenderData
    {
        public Mesh sharedMesh;
        public Material sharedMaterial;
        [HideInInspector] 
        public ShadowCastingMode shadowCastingMode;
        [HideInInspector]
        public string name;
        [HideInInspector]
        public bool isSkinMesh;
        [HideInInspector]
        public Matrix4x4 transformOffset;
    }
}